package jfoo.playlist;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Iterator;

import audio.AudioFile;

public class Playlist implements Serializable {
	private ArrayList<AudioFile> audioFiles;
	private String name;
	private int lastSelectedIndex = -1;
	private int currentlyPlayingIndex = -1;

	// private boolean currentlyPlayingInThePlaylist = false;

	public Playlist(String name) {
		this.name = name;
		audioFiles = new ArrayList<AudioFile>();
	}
	
	public Playlist(String name, ArrayList<AudioFile> audioFiles){
		this.audioFiles = audioFiles;
		this.name = name;
	}

	public void clear() {
		audioFiles.clear();
	}

	public int getLastSelectedIndex() {
		return lastSelectedIndex;
	}

	public void setLastSelectedIndex(int lastSelectedIndex) {
		this.lastSelectedIndex = lastSelectedIndex;
	}

	public int getIndexOf(AudioFile f) {
		return audioFiles.indexOf(f);
	}

	public void add(AudioFile audioFile) {
		audioFiles.add(audioFile);

	}

	public void add(ArrayList<AudioFile> arrayList) {
		Iterator<AudioFile> it = arrayList.iterator();
		while (it.hasNext()) {
			this.add(it.next());
		}
	}

	public ArrayList<AudioFile> getAudioFiles() {
		return audioFiles;
	}

	public String toString() {
		return this.name;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public int getCurrentlyPlayingIndex() {
		return currentlyPlayingIndex;
	}

	public void setCurrentlyPlayingIndex(int currentlyPlayingIndex) {
		this.currentlyPlayingIndex = currentlyPlayingIndex;
	}

	// public boolean isCurrentlyPlayingInThePlaylist() {
	// return currentlyPlayingInThePlaylist;
	// }
	//
	//
	//
	//
	//
	//
	// public void setCurrentlyPlayingInThePlaylist(boolean
	// currentlyPlayingInThePlaylist) {
	// this.currentlyPlayingInThePlaylist = currentlyPlayingInThePlaylist;
	// }

}
